package org.company.tool;

import java.sql.SQLException;

import org.company.tool.bean.EntityBean;
import org.company.tool.tools.GenerateTool;

/**
 * Main-Class
 *
 */
public class App 
{
    public static void main( String[] args ) throws SQLException
    {
    	String tableName =null;
    	String packageName = null;
    	String location = "";
    	String sqlMapLocation = "";
    	if(args.length < 2) {
    		System.err.println("Usage:java App <talbeName> <packageName> [location] [sqlMapLocation]");
    		return;
    	} else if(args.length == 2) {
    		tableName = args[0];
    		packageName = args[1];
    	} else if(args.length == 3) {
    		tableName = args[0];
    		packageName = args[1];
    		location = args[2];
    	} else if(args.length == 4) {
    	    tableName = args[0];
            packageName = args[1];
            location = args[2];
            sqlMapLocation = args[3];
    	}
    	EntityBean entityBean = new EntityBean(tableName, packageName, location, sqlMapLocation);
        GenerateTool tools = new GenerateTool(entityBean);
        tools.generateJava();
    }
}
